﻿using Ionic.Zip;
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace Sync_ZIPArchive
{
    class ZipControler
    {
        private ZipFile _zip;

        public ZipControler()
        {
            _zip = new ZipFile();
            _zip.CompressionLevel = Ionic.Zlib.CompressionLevel.BestCompression;
        }

        public void AddFile(string fileName)
        {
            _zip.AddFile(fileName, fileName);
        }

        public void AddDirectory(string nameDirectory)
        {
            _zip.AddDirectory(nameDirectory, nameDirectory);
        }

        public void SaveZip(string nameZip)
        {
            _zip.Comment = "This zip was created at " + System.DateTime.Now.ToString("G") + "\n --- Created by SyncProject";
            _zip.Save(nameZip);
        }

        public Ionic.Zlib.CompressionLevel CompressionLevel
        {
            get { return _zip.CompressionLevel; }
            set { _zip.CompressionLevel = value; }
        }
    }
}
